<?php
$this->widget('zii.widgets.grid.CGridView', array(
    'id' => 'document-grid',
    'dataProvider' => $model->allDocument(),
    'columns' => array(
        'date:date:Date added',
        'type:text:Type',
        'name:text:Name',
        'remark:text:Remark',
        array(
            'class'=>'CButtonColumn',
            'viewButtonUrl'=>'CHtml::normalizeUrl(array("/documents/view","id"=>$data->id))',
            'viewButtonOptions'=>array('id'=>'view'),
            'deleteButtonUrl'=>'CHtml::normalizeUrl(array("/documents/delete","id"=>$data->id))',
            'deleteButtonOptions'=>array('id'=>'delete'),
        )
    ),
));
?>
<?php
$script =<<<EOD
$('#document-grid a#view').live('click',function(){
    $.simplelogajax.popup($(this).attr('href'));
    return false;
});
EOD;
$cs = Yii::app()->getClientScript();
$cs->registerScript('cargo_documents#tab',$script);
?>